package org.atlantis.grosbeak.depot.proxy.value;

import org.atlantis.grosbeak.depot.DepotMaker;
import org.atlantis.grosbeak.depot.desc.ValueDesc;
import org.atlantis.grosbeak.depot.proxy.ValueProxy;

/**
 * 数组值代理。在配置文件中的格式应该是：“['xxx', 'xxx', 'xxx']”，那么返回的就是一个数组。
 * 
 * @author <a href="mailto:seenoevil.cn@gmail.com">SeeNoEvil</a>
 * 
 */
public class ArrayValueProxy implements ValueProxy {

	private ValueProxy[] values;

	public ArrayValueProxy(DepotMaker maker, ValueDesc[] vds) {
		values = new ValueProxy[vds.length];
		for (int i = 0; i < vds.length; i++) {
			values[i] = maker.makeValue(vds[i]);
		}
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * org.atlantis.grosbeak.depot.proxy.ValueProxy#get(org.atlantis.grosbeak
	 * .depot.DepotMaker)
	 */
	public Object get(DepotMaker maker) {
		Object[] re = new Object[values.length];
		for (int i = 0; i < values.length; i++) {
			re[i] = values[i].get(maker);
		}
		return re;
	}
}
